package com.bootdo.common.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Select;

public interface GeneratorMapper {
	@Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables"
			+ " where table_schema = (select database())")
	List<Map<String, Object>> list();

	@Select("select count(*) from information_schema.tables where table_schema = (select database())")
	int count(Map<String, Object> map);

	@Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables \r\n"
			+ "	where table_schema = (select database()) and table_name = #{tableName}")
	Map<String, String> get(String tableName);

	@Select("select column_name columnName,\n" +
			"\tdata_type dataType,\n" +
			"\tCOLUMN_TYPE,\n" +
			"\tCHARACTER_MAXIMUM_LENGTH,\n" +
			"\tCHARACTER_OCTET_LENGTH,\n" +
			"\tNUMERIC_PRECISION,\n" +
			"\tNUMERIC_SCALE,\n" +
			"\tcolumn_comment columnComment,\n" +
			"\tcolumn_key columnKey,\n" +
			"\textra,\n" +
			"\tORDINAL_POSITION  from information_schema.columns\r\n"
			+ " where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position")
	List<Map<String, String>> listColumns(String tableName);
}
